package com.lianqi.emcpframework.data.masker.stratgey;

import com.lianqi.emcpframework.data.masker.annotation.MaskData;

import java.lang.reflect.ParameterizedType;

/**
 * @program emcp-framework
 * @ClassName DataMaskStrategy
 * @description: 数据脱敏策略定义接口
 * @author: sky
 * @create: 2019/05/26 10:42
 */
public interface DataMaskStrategy<T> {

    static final String DEFAULT_MASK_CHAR = "*";

    default Class<?> supportType(){
        ParameterizedType type = (ParameterizedType)this.getClass().getGenericInterfaces()[0];
        return (Class<?>) type.getActualTypeArguments()[0];
    }

    T maskValue(Object value, MaskData maskData);

    int defaultMaskLeft();

    int defaultMaskRight();

}
